import request from "@/utils/request";

/**
 * 待派工信息api接口集合
 * @method postProcessTaskList 获取规程下的工序
 * @method postTaskList 待派工数据
 * @method getMaterial 获取规程下所有物料
 * @method checkOnlyOneSchema 校验规程的方案
 * @method batchDispatchTask 批量派工
 * @method getUserInfo 获取用户信息
 * @method cancelDispatch 取消派工
 * @method getSchemaList 获取人员模板
 * @method singleDispatchTask 单个派工
 * @method changeUser 修改操作者或检验着
 * @method appendAllotSchema 追加方案信息
 * @method addAllotSchema 添加方案信息
 * @method obsoletedTask 作废任务
 * @method cloneSchema 人员模板克隆
 * @method changeAssigner 规程更换负责人
 * @method getSchemaItem 获取人员模板详情
 * @method setSubmitCode 填写提交单号
 * @method checkChangePrincipal 检查是否能够更换负责人
 * @method getObject 获取人员模板的详情信息
 */
export function getTask(params,loading) {
  return request({
    url: "/mes/specificationTaskController/list",
    method: "get",
    params,
    loading
  });
}
export function getProcessListHasChildren(params,loading) {
  return request({
    url: "/mpm/processController/listHasChildren",
    method: "post",
    data: params,
    loading
  });
}
export function getProcessList(params,loading) {
  return request({
    url: "/mpm/processController/list",
    method: "post",
    data: params,
    loading
  });
}
export function postTaskList(params,loading) {
  return request({
    url: "/mes/specificationTaskController/listUnDispatchTask",
    method: "post",
    data: params,
    loading
  });
}
export function postProcessTaskList(params,loading) {
  return request({
    url: "/mes/processTaskController/list",
    method: "get",
    params,
    loading
  });
}
export function listTask(params,loading) {
  return request({
    url: "/mes/processTaskController/listTask",
    method: "post",
    data: params,
    loading
  });
}
export function getMaterial(params,loading) {
  return request({
    url: "/mpm/processController/listMaterial",
    method: "post",
    data: params,
    loading
  });
}
export function checkOnlyOneSchema(params,loading) {
  return request({
    url: "/mes/specificationTaskController/checkOnlyOneSchema",
    method: "post",
    data: params,
    autoUntie: false,
    loading
  });
}
export function batchDispatchTask(params,loading) {
  return request({
    url: "/mes/specificationTaskController/dispatchTask",
    method: "post",
    data: params,
    autoUntie: false,
    loading
  });
}
export function singleDispatchTask(params,loading) {
  return request({
    url: "/mes/specificationTaskController/singleDispatchTask",
    method: "post",
    data: params,
    autoUntie: false,
    loading
  });
}
export function getUserInfo(params,loading){
  return request({
    url: `/permission/userQueryController/referGrid`,
    method: "get",
    params,
    loading
  });
}
export function getSchemaList(params,loading){
  return request({
    url: `/mes/allotSchemaController/listEnableSchema`,
    method: "get",
    autoUntie: false,
    params,
    loading
  });
}
export function cancelDispatch(params,loading){
  return request({
    url: "/mes/specificationTaskController/cancelDispatch",
    method: "post",
    data: params,
    loading
  });
}
export function obsoletedTask(params,loading){
  return request({
    url: "/mes/specificationTaskController/obsoletedTask",
    method: "post",
    data: params,
    loading
  });
}
export function recoverObsoletedTask(params,loading){
  return request({
    url: "/mes/specificationTaskController/recoverObsoletedTask",
    method: "post",
    data: params,
    loading
  });
}
export function getSchemaItem(params,loading){
  return request({
    url: `/mes/allotSchemaController/listSchemaItem`,
    method: "get",
    params,
    loading
  });
}
export function getObject(params,loading){
  return request({
    url: "/mes/allotSchemaController/getObject",
    method: 'get',
    resField:'obj',
    autoUntie:false,
    params,
    loading
  });
}
export function addAllotSchema(params,loading){
  return request({
    url: "/mes/allotSchemaController/addAllotSchema",
    method: "post",
    data: params,
    loading
  });
}
export function editAllotSchema(params,loading){
  return request({
    url: "/mes/allotSchemaController/editAllotSchema",
    method: "post",
    data: params,
    loading
  });
}
export function appendAllotSchema(params,loading){
  return request({
    url: "/mes/allotSchemaController/appendAllotSchema",
    method: "post",
    data: params,
    loading
  });
}
export function changeUser(params,loading){
  return request({
    url: "/mes/processTaskController/changeUser",
    method: "post",
    data: params,
    loading
  });
}

export function clearChecker(data,loading){
  return request({
    url:'/mes/processTaskController/clearCheck',
    method:'post',
    data:data,
    loading
  });
}
export function cloneSchema(params,loading){
  return request({
    url: `/mes/allotSchemaController/cloneSchema`,
    method: "post",
    data: params,
    loading
  });
}
export function changeAssigner(params,loading){
  return request({
    url: `/mes/specificationTaskController/changeAssigner`,
    method: "post",
    data: params,
    loading
  });
}
export function setSubmitCode(params,loading){
  return request({
    url: `/mes/processTaskController/setSubmitCode`,
    method: "post",
    data: params,
    loading
  });
}
export function checkChangePrincipal(params,loading){
  return request({
      url: "/mes/specificationTaskController/checkChangePrincipal",
      method: "post",
      data: params,
    loading
  });
}
export function dispatchTaskSchems(params,loading){
  return request({
    url: "/mes/specificationTaskController/dispatchTaskSchems",
    method: "post",
    data: params,
    loading
  });
}
